package settings_api

import (
	"github.com/gin-gonic/gin"
	"zswei.xyz/manager/global"
	"zswei.xyz/manager/models/res"
)

// SettingsInfoView 查询系统配置文件
//
//	@Tags			系统管理
//	@Summary		查询系统配置文件
//	@Description	查询系统配置文件接口
//	@Param			data	query	string	true	"site-系统配置 email-邮箱配置 qq-qq配置 qiniu-七牛配置 jwt-jwt权限配置 upload-上传文件配置"
//	@Router			/v2/system/settings [get]
//	@Produce		json
//	@Success		200	{object}	res.Response{}
func (SettingsApi) SettingsInfoView(c *gin.Context) {
	setType := c.Query("type")
	if setType == "" {
		res.FailWithDesc("Type is a required parameter", c)
		return
	}

	switch setType {
	case "site":
		res.OkWithData(global.Config.SiteInfo, c)
	case "email":
		res.OkWithData(global.Config.Email, c)
	case "qq":
		res.OkWithData(global.Config.QQ, c)
	case "qiniu":
		res.OkWithData(global.Config.QiNiu, c)
	case "jwt":
		res.OkWithData(global.Config.Jwt, c)
	case "upload":
		res.OkWithData(global.Config.Upload, c)
	default:
		res.FailWithDesc("未查找到相关配置信息", c)
	}

}
